﻿using System.Collections.Generic;
using Metro.Kashikoi.Service.Common.Entity;
using Metro.Kashikoi.Service.Location.Business;
using Metro.Kashikoi.ServiceContract.Location;

namespace Metro.Kashikoi.Service.Test.Location
{
    class MockFacade : IFacade
    {
        public IUnitOfWork context { get; set; }
        public object Entity { get; set; }
        public int EntityId { get; set; }


        public void CreateOrganization(IUnitOfWork context, Organization organization)
        {
            this.context = context;
            this.Entity = organization;
        }

        public void UpdateOrganization(IUnitOfWork context, Organization organization)
        {
            this.context = context;
            this.Entity = organization;
        }

        public void DeleleOrganization(IUnitOfWork context, int organizationId, IList<int> deletedStockArea)
        {
            this.context = context;
            this.EntityId = organizationId;
        }

        public Organization GetDefaultOrganization(IUnitOfWork context)
        {
            this.context = context;
            return new Organization();
        }

        public Organization GetOrganization(IUnitOfWork context, string name)
        {
            this.context = context;
            return new Organization { Name = name };
        }

        public void CreateFacility(IUnitOfWork context, Facility facility, int organizationId)
        {
            this.context = context;
            this.Entity = facility;
            this.EntityId = organizationId;
        }

        public void UpdateFacility(IUnitOfWork context, Facility facility)
        {
            this.context = context;
            this.Entity = facility;
        }

        public void DeleteFacility(IUnitOfWork context, int facilityId, IList<int> deletedStockArea)
        {
            this.context = context;
            this.EntityId = facilityId;
        }

        public void CreateUnit(IUnitOfWork context, Unit unit, int facilityId)
        {
            this.context = context;
            this.Entity = unit;
            this.EntityId = facilityId;
        }

        public void UpdateUnit(IUnitOfWork context, Unit unit)
        {
            this.context = context;
            this.Entity = unit;
        }

        public void DeleteUnit(IUnitOfWork context, int unitId, IList<int> deletedStockArea)
        {
            this.context = context;
            this.EntityId = unitId;
        }

        public void CreateStockArea(IUnitOfWork context, StockArea stockArea, int unitId)
        {
            this.context = context;
            this.Entity = stockArea;
            this.EntityId = unitId;
        }

        public void UpdateStockArea(IUnitOfWork context, StockArea stockArea)
        {
            this.context = context;
            this.Entity = stockArea;
        }

        public void DeleteStockArea(IUnitOfWork context, int stockAreaId)
        {
            this.context = context;
            this.EntityId = stockAreaId;
        }

        public StockArea GetStockArea(IUnitOfWork context, int stockAreaId)
        {
            this.context = context;
            return new StockArea { Id = stockAreaId };
        }
    }
}
